package com.chahua.organized.entity;

import com.fasterxml.jackson.annotation.JsonInclude;
import lombok.Data;
import lombok.NoArgsConstructor;

import java.util.Date;
import java.util.List;

/**
 * @author chahua
 * @date 2022/4/9 17:26
 **/

@Data
@NoArgsConstructor
public class Department {

    public Department(String name, int pid) {
        this.name = name;
        this.pid = pid;
        this.createTime = new Date();
        this.updateTime = new Date();
    }

    /**
     * 主键
     */
    private Integer id;
    /**
     * 部门名称
     */
    private String name;
    /**
     * 父级部门id
     */
    private Integer pid;
    /**
     * 创建时间
     */
    private Date createTime;
    /**
     * 更新时间
     */
    private Date updateTime;

    /**
     * 子部门节点
     */
//    @Transient
    @JsonInclude(JsonInclude.Include.NON_EMPTY)
    private List<Department> children;
}
